home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / ZIEXPIRE.CPP < prev    next >
C/C++ Source or Header  |  1993-08-02  |  5KB  |  164 lines

  1. //----------------------------------------------------------------------------
  2. //                            MODULE DESCRIPTION
  3. //
  4. //  Module:    znexpire.cpp
  5. //   Title:    ZIP+4 Engine
  6. //  Notice:    John M. Weeder
  7. //                 Copyright (c) 1993. All rights reserved.
  8. //             This module contains proprietary information and should be 
  9. //                treated as confidential.
  10. //
  11. //----------------------------------------------------------------------------
  12. //                           MAINTENANCE HISTORY
  13. //
  14. // $Workfile$
  15. // $Revision$
  16. //   $Author$
  17. //     $Date$
  18. //      $Log$    
  19. //
  20. //----------------------------------------------------------------------------
  21. //                             MODULE NARRATIVE
  22. //
  23. //    This module contains code for the class XXX.
  24. //
  25. //    The code in this module may be written in C++ or C.
  26. //
  27. //    This module is portable to:
  28. //        DOS 3.X+
  29. //        MS Windows 3.X+
  30. //        OS/2 2.X+
  31. //        OS/2 2.0 PM
  32. //
  33. //    The following compilers are supported:
  34. //        MSC 6.0A
  35. //        MSC/C++ 7.0
  36. //        Borland C++ 3.1 for DOS
  37. //        Borland C++ 1.0 for OS/2 2.X
  38. //
  39. //----------------------------------------------------------------------------
  40. #include <zi.hpp>
  41. #define USE_WIN_EXPIRE
  42. #if OS_DOS
  43. #include <zid.hpp>
  44. #elif OS_WINDOWS
  45. #include <ziw.hpp>
  46. #else
  47. #include <zio.hpp>
  48. #endif
  49.  
  50.  
  51. //----------------------------------------------------------------------------
  52. //   Description:    Default constructor
  53. //    Parameters:
  54. //       Returns:    
  55. //----------------------------------------------------------------------------
  56. FN_M ZI_EXPIRE::ZI_EXPIRE(TIMET _timeExpire, BOOL _fExpired)
  57. : ZN_WINDOW("WIN_EXPIRE", ZN_LOAD_CENTER|ZN_LOAD_NO_SHOW)
  58. {
  59.     ZI_EXPIRE::Initialize(CL_INIT_CLASS);
  60.     timeExpire = _timeExpire;
  61.     fExpired = _fExpired;
  62.     Setup();
  63. }
  64.  
  65.  
  66. //----------------------------------------------------------------------------
  67. //   Description:    Destructor
  68. //    Parameters:
  69. //       Returns:    
  70. //----------------------------------------------------------------------------
  71. FN_M ZI_EXPIRE::~ZI_EXPIRE()
  72. {
  73.     ZI_EXPIRE::Destroy(FALSE);
  74.     Terminate();
  75. }
  76.  
  77.  
  78. //----------------------------------------------------------------------------
  79. //   Description:    Destroy object. Free any resources used by object.
  80. //                          Normally called by destructor.
  81. //                        Should allow multiple calls from various classes.
  82. //                        A class should almost always re-init its variables when 
  83. //                        it is destroyed to prevent accidents.
  84. //    Parameters:    fDestroyAll        Destroy parents also?
  85. //                                            Default is TRUE.
  86. //       Returns:    TRUE if successful.
  87. //----------------------------------------------------------------------------
  88. BOOL FN_M ZI_EXPIRE::Destroy(BOOL fDestroyAll)
  89. {
  90.     ZI_EXPIRE::Initialize(CL_INIT_CLASS_VARS);
  91.     if (fDestroyAll)                            // Destroy parent.
  92.         ZI_EXPIRE_PARENT::Destroy(fDestroyAll);
  93.     return TRUE;
  94. }
  95.  
  96.  
  97. //----------------------------------------------------------------------------
  98. //   Description:    Initialize object. 
  99. //                          Normally called by constructor.
  100. //                        Should allow multiple calls from various classes.
  101. //    Parameters:    sInit        Initialization code. May be one of the following:
  102. //                                        CL_INIT_CLASS            Reset class variables and
  103. //                                                                    and dynamic allocations for
  104. //                                                                    this class only.
  105. //                                        CL_INIT_CLASS_VARS    Reset class variables for
  106. //                                                                    this class only.
  107. //                                        CL_INIT_VARS            Reset class variables for
  108. //                                                                    this class only.
  109. //                                        CL_INIT_ALL                Initialize class and all 
  110. //                                                                    parent class, including
  111. //                                                                    dynamic memory allocation.
  112. //                                    Default is CL_INIT_ALL
  113. //       Returns:    TRUE if successful.
  114. //----------------------------------------------------------------------------
  115. BOOL FN_M ZI_EXPIRE::Initialize(SHORT sInit)
  116. {
  117.     if (sInit == CL_INIT_VARS || sInit == CL_INIT_ALL)
  118.         ZI_EXPIRE_PARENT::Initialize(sInit);
  119.  
  120.     return TRUE;
  121. }
  122.  
  123.  
  124. //----------------------------------------------------------------------------
  125. //   Description:    Event monitor function.
  126. //    Parameters:    msg        Event code
  127. //                        pv1            Data pointer 1
  128. //                        pv2            Data pointer 2
  129. //       Returns:    Event code
  130. //----------------------------------------------------------------------------
  131. ZN_MSG FN_M ZI_EXPIRE::User(ZN_MSG msg, PVOID, PVOID)
  132. {
  133.     switch (msg)
  134.         {
  135.         case ZN_MSG_INIT:
  136.             if (fExpired)
  137.                 SetString(FID(STR_EXPIRES),"The data on this CD-ROM EXPIRED on:");
  138.             else        
  139.                 SetString(FID(STR_EXPIRES),"The data on this CD-ROM will expire on:");
  140.             SetDate(FID(DATE_EXPIRE),timeExpire);
  141.             return msg;
  142.  
  143.         case ZN_MSG_TERMINATE:
  144.             return msg;
  145.  
  146.         }
  147.     if (IsError())                                // Error condition
  148.         return msg;
  149.     switch (msg)
  150.         {
  151.         case BUTTON_OK:
  152.             if (fExpired)
  153.                 Exit();
  154.             else
  155.                 Close();
  156.             break;
  157.         }
  158.     return msg;
  159. }
  160. //----------------------------------------------------------------------------
  161. //------------------------------- End of File --------------------------------
  162. //----------------------------------------------------------------------------
  163.  
  164.